class Address {
    String city;

    public Address(String city) {
        this.city = city;
    }
}

class Person implements Cloneable {
    String name;
    Address address;

    public Person(String name, Address address) {
        this.name = name;
        this.address = address;
    }

    // 将 clone 方法的访问修饰符改为 public
    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}

class Test1 {
    public static void main(String[] args) {
        Address address = new Address("Beijing");
        Person person1 = new Person("Alice", address);
        try {
            // 进行异常处理
            Person person2 = (Person) person1.clone();
            System.out.println("克隆成功，person2 的姓名：" + person2.name + "，地址城市：" + person2.address.city);
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}

